package com.twu.biblioteca.helpers;


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class Encryption {

    private MessageDigest sha;

    public Encryption() {
        try {
            this.sha = MessageDigest.getInstance("SHA-256");
        } catch (NoSuchAlgorithmException e) {
            System.out.print("Error: Encryption");
            System.exit(1);
        }
    }

    public byte[] encodeSHA(String string){
        this.sha.update(string.getBytes());

        return this.sha.digest();
    }
}
